const Radio = require('./radio');
// 实例化电台对象，名称为 "music radio"，频率为 "FM 106.7"
const radio = new Radio("music radio", "FM 106.7");
// 绑定 'open' 事件监听器
radio.on('open', function () {
  console.log(`"${this.name}" ${this.frequency} opened`);
  // 延时两秒输出 "lalala..."
  setTimeout(() => {
    console.log("lalala...");
    // 延时结束后关闭电台
    this.stop();
  }, 2000);
});
// 绑定 'close' 事件监听器
radio.on('close', function () {
  console.log(`"${this.name}" ${this.frequency} closed`);
});
// 调用 play 方法打开电台
radio.play();